package com.example.pattern.state;

/**
 * 应用
 *
 * @author FM_南风
 * @date 2024/7/5
 */
public class StateClient {
    public static void main(String[] args) {
        StateContext context = new StateContext();

        // 设置初始状态为关闭状态
        context.setState(new CloseState());

        // 请求电梯运行
        context.request();

        // 切换到开启状态
        context.setState(new OpenState());
        context.request();

        // 切换到运行状态
        context.setState(new RunningState());
        context.request();

        // 切换到停止状态
        context.setState(new StoppingState());
        context.request();
    }
}
